package org.uk.splitsbrowser.client.presenter;

import org.uk.splitsbrowser.shared.SplitsbrowserException;
import org.uk.splitsbrowser.shared.User;

import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

	/**
	 * The client side stub Event Service
	 */
	@RemoteServiceRelativePath("user")
	public interface UserService {
		
		/** Save existing user details */ 
		void saveUser(User user) throws SplitsbrowserException;
		
		/** Create a new user */ 
		void newUser(User user) throws SplitsbrowserException;
		
		/** Delete the user including links to their results and routes uploaded.
		   Events that the user cleared will no be deleted but will no longer be accessible to edit */
		void deleteUser(String id) throws SplitsbrowserException;
		
		User[] queryUser(String queryString, int offset, int count);

		/** Query for user by email address - a unique key*/
		User queryUser(String userEmail);
		
		/** Return the user by is id */ 
		User getUser(String id);

		/** Attempt to logon.  
		 * If successful it will return the session Id 
		 * If unsuccessful a null String will be returned */
		String logon(User user, String password) throws SplitsbrowserException;
		
		/** logoff */
		void logoff();
		
		/** Reset the user password and send a mail to them informing the of the new 
		 * password.  Invocation should be protected by a catchpa to avoid abuse */ 
		void requestPasswordReset(String userEmail) throws SplitsbrowserException;
		
	}
